home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / lib / include / sun3.md / RCS / reg.h,v < prev    next >
Encoding:
Text File  |  1990-12-08  |  6.0 KB  |  217 lines

  1. head     1.2;
  2. branch   ;
  3. access   ;
  4. symbols  ;
  5. locks    ; strict;
  6. comment  @ * @;
  7.  
  8.  
  9. 1.2
  10. date     90.12.07.23.48.03;  author rab;  state Exp;
  11. branches ;
  12. next     1.1;
  13.  
  14. 1.1
  15. date     90.11.13.14.40.16;  author rab;  state Exp;
  16. branches ;
  17. next     ;
  18.  
  19.  
  20. desc
  21. @@
  22.  
  23.  
  24. 1.2
  25. log
  26. @Some changes for new gdb.  Reg.h need to be more like the sunos reg.h.
  27. @
  28. text
  29. @/*      @@(#)reg.h 1.6 88/08/19 SMI      */
  30.  
  31. /*
  32.  * Copyright (c) 1986 by Sun Microsystems, Inc.
  33.  */
  34.  
  35. #ifndef _sun3_reg_h
  36. #define _sun3_reg_h
  37.  
  38. #define R0      (0)
  39. #define R1      (1)
  40. #define R2      (2)
  41. #define R3      (3)
  42. #define R4      (4)
  43. #define R5      (5)
  44. #define R6      (6)
  45. #define R7      (7)
  46. #define AR0     (8)
  47. #define AR1     (9)
  48. #define AR2     (10)
  49. #define AR3     (11)
  50. #define AR4     (12)
  51. #define AR5     (13)
  52. #define AR6     (14)
  53. #define AR7     (15)
  54. #define SP      (15)
  55. #define PS      (16)
  56. #define PC      (17)
  57.  
  58. /*
  59.  * And now for something completely the same...
  60.  */
  61. #ifndef LOCORE
  62. struct regs {   
  63.         int     r_dreg[8];      /* data registers */
  64. #define r_r0    r_dreg[0]       /* r0 for portability */
  65.         int     r_areg[8];      /* address registers */
  66. #define r_sp    r_areg[7]       /* user stack pointer */
  67.         int     r_sr;           /* status register (actually a short) */
  68. #define r_ps    r_sr
  69.         int     r_pc;           /* program counter */
  70. };
  71.  
  72. struct stkfmt {
  73.         int     f_stkfmt : 4;   /* stack format */
  74.         int              : 2;
  75.         int     f_vector : 10;  /* vector offset */
  76.         short   f_beibase;      /* start of bus error info (if any) */
  77. };
  78.  
  79. #endif !LOCORE
  80.  
  81. /*
  82.  * Struct for floating point registers and general state
  83.  * for the MC68881 (the sky fpp has no user visible state).
  84.  * If fps_flags == FPS_UNUSED, the other 68881 fields have no meaning.
  85.  * fps_flags is a software implemented field; it is not used when set
  86.  * by user level programs.
  87.  */
  88.  
  89. #ifndef LOCORE
  90. typedef    struct ext_fp {
  91.     int    fp[3];
  92. } ext_fp;        /* extended 96-bit 68881 fp registers */
  93.  
  94. struct fp_status {
  95.     ext_fp    fps_regs[8];        /* 68881 floating point regs */
  96.     int    fps_control;        /* 68881 control reg */
  97.     int    fps_status;        /* 68881 status reg */
  98.     int    fps_iaddr;        /* 68881 instruction address reg */
  99.     int    fps_flags;        /* r/o - unused, idle or busy */
  100. };
  101.  
  102. /*
  103.  * Values defined for `fps_flags'.
  104.  */
  105. #define    FPS_UNUSED    0        /* 68881 never used yet */
  106. #define    FPS_IDLE    1        /* 68881 instruction completed */
  107. #define    FPS_BUSY    2        /* 68881 instruction interrupted */
  108.  
  109. /*
  110.  * The EXT_FPS_FLAGS() macro is used to convert a pointer to an
  111.  * fp_istate into a value to be used for the user visible state
  112.  * found in fps_flags.  As a speed optimization, this convertion
  113.  * is only done is required (e.g.  the PTRACE_GETFPREGS ptrace
  114.  * call or when dumping core) instead of on each context switch.
  115.  * The tests that we base the state on are that a fpis_vers of
  116.  * FPIS_VERSNULL means NULL state, else a fpis_bufsiz of FPIS_IDLESZ
  117.  * means IDLE state, else we assume BUSY state.
  118.  */
  119. #define    FPIS_VERSNULL    0x0
  120. #define    FPIS_IDLESIZE    0x18
  121.  
  122. #define EXT_FPS_FLAGS(istatep) \
  123.     ((istatep)->fpis_vers == FPIS_VERSNULL ? FPS_UNUSED : \
  124.         (istatep)->fpis_bufsiz == FPIS_IDLESIZE ? FPS_IDLE : FPS_BUSY)
  125.  
  126. /* 
  127.  * Structures for the status and data registers are defined here.
  128.  * Struct fpa_status are included in the u area.
  129.  * Struct fpa_regs is included in struct core.
  130.  */
  131.  
  132. /* struct fpa_status is saved/restored during context switch */
  133. struct fpa_status {
  134.     unsigned int    fpas_state;    /* STATE, supervisor privileged reg */
  135.     unsigned int    fpas_imask;    /* IMASK */
  136.     unsigned int    fpas_load_ptr;    /* LOAD_PTR */
  137.     unsigned int    fpas_ierr;    /* IERR */
  138.     unsigned int    fpas_act_instr; /* pipe active instruction halves */
  139.     unsigned int    fpas_nxt_instr; /* pipe next instruction halves */
  140.     unsigned int    fpas_act_d1half;/* pipe active data first half */
  141.     unsigned int    fpas_act_d2half;/* pipe active data second half */
  142.     unsigned int    fpas_nxt_d1half;/* pipe next data first half */
  143.     unsigned int    fpas_nxt_d2half;/* pipe next data second half */
  144.     unsigned int    fpas_mode3_0;    /* FPA MODE3_0 register */
  145.     unsigned int    fpas_wstatus;    /* FPA WSTATUS register */
  146. };
  147.  
  148. /* 
  149.  * Since there are 32 contexts supported by the FPA hardware,
  150.  * when we do context switch on the FPA, we don't save/restore
  151.  * the data registers between the FPA and the u area.
  152.  * If there are already 32 processes using the fpa concurrently,
  153.  * we give an error message to the 33rd process trying to use the fpa.
  154.  * (Hopefully there will not be this many processes using FPA concurrently.)
  155.  */
  156.  
  157. #define FPA_NCONTEXTS        32
  158. #define FPA_NDATA_REGS        32
  159.  
  160. typedef struct fpa_long {
  161.     int     fpl_data[2];
  162. } fpa_long;         /* 64 bit double precision registers */
  163.  
  164. /* Struct fpa_regs is included in struct core. */
  165. struct fpa_regs {
  166.     unsigned int    fpar_flags; /* if zero, other fields are meaningless */
  167.         struct fpa_status    fpar_status;
  168.         fpa_long    fpar_data[FPA_NDATA_REGS];
  169. };
  170.  
  171. /*
  172.  * The size of struct fpa_regs is changed from 141 ints in 3.0 to
  173.  * 77 ints in 3.x.  A pad of this size difference is added to struct core.
  174.  */
  175. #define CORE_PADLEN    64
  176.  
  177. /* 
  178.  * If there is going to be external FPU state then we must define the FPU 
  179.  * variable
  180.  */
  181. struct fpu {
  182.     struct     fp_status f_fpstatus;    /* External FPP state, if any */
  183.     struct  fpa_regs f_fparegs;    /* FPA registers, if any */
  184.     int    f_pad[CORE_PADLEN];    /* see comment above */
  185. };
  186. #define ip_fpa_flags    ip_fpu.f_fparegs.fpar_flags
  187. #define ip_fpa_state    ip_fpu.f_fparegs.fpar_status.fpas_state
  188. #define ip_fpa_status    ip_fpu.f_fparegs.fpar_status
  189. #define ip_fpa_data    ip_fpu.f_fparegs.fpar_data
  190. #endif !LOCORE
  191.  
  192. /*
  193.  * Defining FPU means that there is externel floating point state 
  194.  * available to the user.  This state could be either the 68881 or
  195.  * the fpa.  We do not make that distinction here.  This variable
  196.  * cause all the appropriate code to be included.  It is defined 
  197.  * here instead of in the makefile since we do not know for sure 
  198.  * that an 68881 or fpa will be in the system.  Be prepared.
  199.  */
  200. #ifdef KERNEL
  201. #define FPU
  202. #endif KERNEL
  203.  
  204. #endif /*!_sun3_reg_h*/
  205. @
  206.  
  207.  
  208. 1.1
  209. log
  210. @Initial revision
  211. @
  212. text
  213. @d10 43
  214. a52 1
  215. #include <m68k/reg.h>
  216. @
  217.